// Hardware Buffer Array
// (c) jimon game studio

#ifndef JEH_IHARDWAREBUFFERARRAY
#define JEH_IHARDWAREBUFFERARRAY

#include "IHardwareBuffer.h"

namespace je
{
	namespace video
	{
		//! Hardware Buffer Array Layers
		enum HardwareBufferArrayLayers
		{
			//! Position Layer
			HBAL_POSITION = 0,

			//! Normal Layer
			HBAL_NORMAL = 1,

			//! Uv Layer
			HBAL_UV = 2,

			//! Color Layer
			HBAL_COLOR = 3,

			//! Tangent Layer
			HBAL_TANGENT = 4,

			//! Bones Layer
			HBAL_BONES_IDS = 5,

			//! Bones Layer
			HBAL_BONES_W = 6,

			//! User Layer 1
			HBAL_USER_1 = 7,

			//! User Layer 2
			HBAL_USER_2 = 8,

			//! Index Layer
			HBAL_INDEXES = JE_MAX_SHADER_VERTEX_LAYERS
		};

		//! Hardware Buffer Array
		class IHardwareBufferArray:public je::jeUnknown
		{
		public:
			//! Destructor
			virtual ~IHardwareBufferArray()
			{
			}

			//! Attach Hardware Buffer
			//! ThisIsIntFormat need to setup int vbo, because int and float have 4 bite size, and no additional info about format enesea doesnt have
			//! another support attach format for vertex coordinate u8,s16,s32,f32,f64
			virtual void AttachBuffer(IHardwareBuffer * Buffer,HardwareBufferArrayLayers Layer,s32 VariablesPerObject,s32 VariableSize,s32 Stride = 0,s32 Offset = 0,u1 ThisIsIntFormat = false) = 0;

			//! Layer Info
			struct LayerInfo
			{
				IHardwareBuffer * Buffer;
				s32 VariablesPerObject;
				s32 VariableSize;
				s32 Stride;
				s32 Offset;
				u1 ThisIsIntFormat;

				LayerInfo()
					:Buffer(NULL),VariablesPerObject(0),VariableSize(0),Stride(0),Offset(0),ThisIsIntFormat(false)
				{
				}
			};

			//! Get Layer Info
			virtual LayerInfo & GetLayerInfo(HardwareBufferArrayLayers Layer) = 0;

			//! Update layers
			virtual void UpdateLayers() = 0;
		};
	}
}

#endif
